#include <iostream>

using namespace std;

void rowSum(int a[3][4])//计算数组每一行的和
{
    int i = 0, j = 0;

    for (i = 0; i < 3; i++)
    {
        for (j = 1; j < 4; j++)
            a[i][0] += a[i][j];
    }

}

int main()
{
    int table[3][4] = {{1,2,3,4},{2,3,4,5},{3,4,5,6}};
    int i = 0, j = 0;

    for(i = 0; i < 3; i++)
    {
        for(j = 0; j < 4; j++)
        {
            cout << table[i][j] << " " ;

            if (j == 3)
                cout << endl;
        }
    }

    rowSum(table);//使用数组名作为实参

    for(i = 0; i < 3; i++)
        cout << table[i][0] << endl;

    return 0;
}
